<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>v-on</title>
    <script type="text/javascript" src="../assets/js/vue.js"></script>
</head>
<body>
    <h1>v-on</h1>
    <hr>
    <div id="app">
        <p>当前分数：{{count}}</p>
        <p>
            <button v-on:click="addCount">加分</button>
            <button v-on:click="reduceCount">减分</button>
        </p>
        <p>
            <input type="text" v-on:keyup.enter="onEnter" v-model="moreCount">
        </p>
    </div>
    <script>
        var app = new Vue({
            el : "#app",
            data : {
                count : 0,
                moreCount : 1
            },
            methods: {
                addCount : function () {
                    this.count++;
                },
                reduceCount : function () {
                    this.count--;
                },
                onEnter : function () {
                    this.count += parseInt(this.moreCount);
                }
            }
        })
    </script>
</body>
</html>